Hint : Use "Undo" under the "Edit" menu (or -Z) as a convenient way
to deleted text output from AxoCalculator.
Basic Arithmetic
To perform a calculation, type in any arithmetic expression then press the "enter" key. For example, place the flashing insert cursor anywhere in the next line, then press "enter".
2 + 2
(Note: The slight delay is due to the large size of this text file.)
Here is another example demonstrating the use of brackets to control the order of calculation, and exponentiation ( ** or ^ ).
(55+6.6*10) / (3 ** 3)
List of Operators
+ Addition
- Subtraction
/ Division
* Multiplication
^ Raise to the power
** Alternative raise to the power
Div Integer division
\ Alternative integer division
Mod Remainder after integer division
++ Increment
-- Decrement
> Greater than
< Less than
>= Greater than or equal to
<= Less than or equal to
= Is equal to
<> Is not equal to
!= Alternative is not equal to
and Logical "and"
or Logical "or"
not Logical "not"
& Alternative logical "and"
| Alternative logical "or"
&& Alternative logical "and"
|| Alternative logical "or"
! Alternative logical "not"
Built in Functions
AxoCalculator has many built in functions. For a complete list see the document "Built in Functions". Here are three examples showing various uses of these functions.
pi * 2.25 ^ 2
sin(30) + cos(-60)
500 * exp( -25 * pi * tan(15.4) / 4 )
Named Variables
AxoCalculator supports named variables. As an example, execute the following three expressions. You can execute each expression in turn, but it is faster to select all three lines using the mouse, then press "enter".
a = 7
b = 100
a+b
Declaring an Array
AxoCalculator supports one dimensional arrays and array calculations. Execute one of the following expressions to create a new array.
Note : If you wish to test the example array expressions below
please execute only those associated with the currently
selected language ("Settings" under the "Calculator" menu),
and execute them in the order they occur.
In any Language
newArray (myArr, 50)
In Pascal
VAR myArr : Array[1..50]
In Fortran
Real myArr(50)
In Basic
DIM myArr(50)
In C
float myArr[50]
To verify that the array was created, select "Show Status" under the "Calculator" menu. "myArr" should be listed as a global variable.
Initializing an Array using a Program
When an array is declared, its elements are automatically set to zero. One way to initialize an array to non-zero values is within a program loop.
In Pascal
For j = 1 to 50 do myArr[j] = 5
In Fortran
Do j = 1, 50
myArr(j) = 5
EndDo
In Basic
For j = 1 to 50
myArr(j) = 5
Next j
In C
For (j = 0 ; j < 50 ; j++) myArr[j] = 5
Note that in C, "myArr" is indexed from 0 to 49. All other languages index "myArr" from 1 to 50.
The various loop commands used above are described in the programming language documentation. To verify that the array has been initialized, check the first 4 elements by executing the following expression.
writeArr (myArr, 1, 4)
Initializing an Array from a List of Values
Several arrays may be declared and initialized in a single step if a tab delimited list of values is available. For example, select the following 11 lines, then press "enter". (Note: the columns are separated by tabs).
Array
my1stArr my2ndArr
1 9
2 8
3 7
4 6
5 5
6 4
7 3
8 2
9 1
Verify that the arrays have been correctly initialized by executing the following expression.
In Pascal
For j = 1 to 9 do writeLn (my1stArr[j],' ',my2ndArr[j])
Arrays can be manipulated like ordinary numeric variables. For example the following expression multiplies every element of "myArr" by 5 and adds 5. The second line checks the values of some array elements.
myArr = myArr * 5 + 5
writeArr (myArr, 45, 50)
Arrays may also be added or multiplied together and the result assigned to a new array created "on the fly".
newArr = my1stArr * my2ndArr
writeArr (newArr)
Most built in functions work with arrays. The function is applied to each element of the array, and a new array returned.
sinArr = sin(2 * newArr)
writeArr (sinArr)
Since each new array takes up additional memory, you should avoid creating lots of large arrays. If memory becomes a problem, unload arrays when you are finished with them. The following expression unloads all the arrays created during this tutorial.